package com.hjy.coupon.controller;

import com.hjy.common.utils.R;
import com.hjy.coupon.feign.TestFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
@RefreshScope
public class TestController {

    @Autowired
    public TestFeign testFeign;

    @Value("${gulimall.coupon.name}")
    private String name;

    @Value("${gulimall.coupon.age}")
    private int age;

    @RequestMapping("/hello")
    public R hello() {
        return R.ok().put("coupon","hello").put("member",testFeign.hello());
    }

    @RequestMapping("/hello2")
    public R hello2() {
        return R.ok().put("name",name).put("age",age);
    }
}
